<?php
session_start();
include_once '../Model/M_SubRubro.php';
$subrubro=new M_SubRubro();
$subrubro->setIdSubRubro($_REQUEST['idSubRubro']);
$Objrubro = $subrubro->searchSubRubro();
if($Objrubro[0]['imagen'])
{
    unlink('../View/images/SubRubro/'.$Objrubro[0]['imagen']);
}

$rpta=$subrubro->deleteSubRubro();
if($rpta){
    $_SESSION['color']='greenyellow';
    $_SESSION['mensaje']='Se Guardaron los Cambios';
    $_SESSION['pag']='SubRubro/V_SubRubro.php?idPag='.$_REQUEST['idPag'];
}else{
    $_SESSION['color']='red';
    $_SESSION['mensaje']='No se Pudo guardar los Cambios';
    $_SESSION['pag']='SubRubro/V_SubRubro.php?idPag='.$_REQUEST['idPag'];
}
?>
<script language="JavaScript" type="text/javascript">
    location.href='../View/Mensaje.php';
</script>
